Plot things
We will create a dummy tracer as a function of location to showcase each plot, just for the sake of the examples herein.
This guide is organized as follows
In this guide we will focus on how-to plot things using AIBECS' built-in recipes for Plots.jl. These recipes are implemented using RecipesBase.jl, which are explained in Plots.jl's documentation.
Throughout we will use the OCIM1 grid.
using AIBECS, Plots
grd, _ = OCIM1.load()(,
[1 , 1] = 0.000197784
[2 , 1] = 1.05541e-8
[10384 , 1] = -2.09257e-7
[10442 , 1] = -0.000191611
[10443 , 1] = 4.80961e-9
[20825 , 1] = -1.83059e-9
[20883 , 1] = 7.967e-9
[1 , 2] = -5.98052e-8
[2 , 2] = 0.000187532
⋮
[200160, 200159] = -2.04829e-8
[197886, 200160] = 2.41231e-9
[199766, 200160] = 6.70985e-9
[199777, 200160] = -1.26357e-9
[199778, 200160] = -7.22216e-9
[199779, 200160] = 7.59325e-9
[199790, 200160] = -7.41023e-9
[200156, 200160] = -3.07748e-8
[200159, 200160] = -2.14741e-8
[200160, 200160] = 5.22074e-8)Horizontal plots
Horizontal slice
The most common thing you plot after a simulation of marine tracers is a horizontal slice. In this case, you just need to provide the tracer (dummy here), the grid object grd, and the depth at which you want to plot.
iwet = findall(vec(iswet(grd)))
dummy = cos.(ustrip.(upreferred.(grd.lat_3D[iwet])))
horizontalslice(dummy, grd, 10)
You can supply units for the depth at which you want to see the horizontal slice.
horizontalslice(dummy, grd, 10u"m")
And the units should be understood under the hood.
horizontalslice(dummy, grd, 3u"km")
If your tracer is supplied with units, those will show in the colorbar label
horizontalslice(dummy * u"mol/m^3", grd, 10u"m")
The advantage of Plots.jl recipes like this one is that you can specify other pieces of the plot as you would with built-in functions. The advantage of Plots.jl recipes like this one is that you can specify other pieces of the plot as you would with built-in functions. For example, you can chose the colormap
dummy .= cos.(ustrip.(upreferred.(grd.lon_3D[iwet]))) .* dummy
horizontalslice(dummy, grd, 100, color=:magma)
Or you can change predefine bits after the fact.
plt = horizontalslice(dummy, grd, 100, color=:magma)
plot!(plt, xlabel="Lon", ylabel="Lat", colorbar_title="No units", title="The pacific as a whole")
Vertical plots
Exploring the vertical distribution of tracers is important after all.
Zonal slices
You must specify the longitude
dummy .+= sqrt.(ustrip.(grd.depth_3D[iwet])) / 30
zonalslice(dummy, grd, 330)
Zonal averages
Global zonal average
zonalaverage(dummy, grd)
Basin zonal average
(not available yet)
Meridional slices
(not available yet)
Meridional averages
(not available yet... at all?)
Zonal transect
(Not available yet...)
Meridional transect
(Not available yet...)
Depth profiles
interpolateddepthprofile(dummy, grd, 0, 330)
Non geographic plots
This page was generated using Literate.jl.